﻿using System.Web.UI.WebControls;

namespace CodeCamp.BL.Helpers
{
	public static class BindingHelper
	{
		/// <summary>
		/// Binds a control to some data source.
		/// </summary>
		/// <param name="data">The data to bind to.</param>
		/// <param name="control">The control.</param>
		public static void BindTo(this object data, DataList control)
		{
			control.DataSource = data;
			control.DataBind();
		}

		/// <summary>
		/// Binds a control to some data source.
		/// </summary>
		/// <param name="data">The data to bind to.</param>
		/// <param name="control">The control.</param>
		public static void BindTo(this object data, ListView control)
		{
			control.DataSource = data;
			control.DataBind();
		}

	}
}
